import request from '@/utils/request'

// 行程库主接口
export function listItinerary(query) {
  return request({
    url: '/travel/itinerary/list',
    method: 'get',
    params: query
  })
}

export function getItinerary(itineraryId) {
  return request({
    url: `/travel/itinerary/${itineraryId}`,
    method: 'get'
  })
}

export function addItinerary(data) {
  return request({
    url: '/travel/itinerary',
    method: 'post',
    data: data
  })
}

export function updateItinerary(data) {
  return request({
    url: '/travel/itinerary',
    method: 'put',
    data: data
  })
}

export function delItinerary(itineraryId) {
  return request({
    url: `/travel/itinerary/${itineraryId}`,
    method: 'delete'
  })
}

// 行程内容接口
export function getItineraryContent(itineraryId) {
  // 对应后端根据行程ID查询内容列表的接口
  return request({
    url: `/travel/itinerary/content/list`,
    method: 'get',
    params: { itineraryId } // 传递行程ID参数
  })
}

export function batchSaveItineraryContent(data) {
  return request({
    url: '/travel/itinerary/content/batch',
    method: 'post',
    data: data
  })
}

export function delAllItineraryContent(itineraryId) {
  return request({
    url: `/travel/itinerary/content/${itineraryId}`,
    method: 'delete'
  })
}
